package com.gyt.manager.common.enums;


/**
 * @author v_yantgao
 */
public enum DataTypeEnum {

    //double类型,
    Double(1, "Double"),
    //Integer类型,
    Integer(2, "Integer"),
    //String类型
    String(3, "String");

    private Integer value;

    private String desc;

    DataTypeEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public Integer getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    public static boolean checkDataType(Integer value) {
        for (DataTypeEnum dataTypeEnum : values()) {
            if (value.equals(dataTypeEnum.getValue())) {
                return true;
            }
        }
        return false;
    }

    public static DataTypeEnum getValueType(Integer code) {
        switch (code) {
            case 1:
                return Double;
            case 2:
                return Integer;
            case 3:
                return String;
            default:
                return null;
        }
    }

    public static void main(String[] args) {
        System.out.println(getValueType(1).getDesc().toLowerCase());
    }
}
